<?php echo '<?xml version="1.0" encoding="UTF-8"?>', "\r\n"; ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<?php 	if (isset($products) && $products->num_rows() > 0) 
	{
		foreach ($products->result() as $row)
		{
			$post_date = new DateTime($row->post_date); 
			$product_link = get_product_url($row);
			echo '<url>';
			echo "\r\n";
			echo '<loc>',$product_link,'</loc>';
			echo "\r\n";
			echo '<changefreq>',$changefreq,'</changefreq>';
			echo "\r\n";
			echo '<priority>',$priority,'</priority>';
			echo "\r\n";
			echo '</url>';
			echo "\r\n";
		}
	}
?>
</urlset>
